$(function () {
    if ($("#editForm").size() > 0) {
        $("#editForm").validate({
            rules: {
                'employee.name': {
                    required: true,
                    rangelength: [2, 8]
                }, 'employee.password': {
                    required: true,
                    minlength: 2
                }, repassword: {
                    equalTo: "#password"
                }, 'employee.email': {
                    required: true,
                    email: true
                }, 'employee.age': {
                    required: true,
                    range: [18, 60]
                }

            }, messages: {
                'employee.name': {
                    required: "用户名必填",
                    rangelength: "用户名长度必须在{0}位到{1}位之间"
                }, 'employee.password': {
                    required: "密码必填",
                    minlength: "密码长度不能少于{0}位"
                }, repassword: {
                    equalTo: "两次密码输入不一致"
                }, 'employee.email': {
                    required: "邮箱必填",
                    email: "邮箱格式不正确"
                }, 'employee.age': {
                    required: "年龄必填",
                    range: "年龄必须在{0}到{1}之间"
                }
            }
        });
    }

});